<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>Normalize Avisynth Filter</title>
   <link rel="stylesheet" type="text/css" href="../../avisynth.css">
</head>
<body >

<h2><a NAME="Normalize"></a>Normalize
</h2>
<p><code>Normalize </code>(<var>clip, float "volume", bool "show"</var>)
<p>Amplifies the entire waveform as much as possible, without clipping.
<p>By default the clip is amplified to 1.0, that is maximum without clipping
- higher values are sure to clip, and create distortions. If one volume
is supplied, the other channel will be amplified the same amount.
<p>The calculation of the peak value is done the first time the audio is requested, so there will be some seconds until AviSynth continues.
<p>Starting from <em>v2.08</em> there is an optional argument show, if set to <code>true</code>,
it will show the maximum amplification possible without distortions.
<p>Multichannels are never amplified separately by the filter, even if the
level between them is very different. The volume is applied AFTER the maximum
peak has been found, and works in effect as a seperate <a href="amplify.htm"><code>Amplify</code></a>.
That means if you have two channels that are very different the loudest
channel will also be the peak for the lowest. If you want to normalize
each channel seperately, you must use <a href="getchannel.htm"><code>GetChannel</code></a>
to split up the stereo source.
<p>The audio sample type is converted to float or is left untouched if it is 16 bits.
<p>Examples:
<pre># normalizes signal to 98%
video = AviSource(&quot;C:\video.avi&quot;)
audio = WavSource(&quot;c:\autechre.wav&quot;)
audio = Normalize(audio, 0.98)
return AudioDub(video, audio)

# normalizes each channel seperately
video = AviSource(&quot;C:\video.avi&quot;)
audio = WavSource(&quot;C:\bjoer7000.wav&quot;)
left_ch = GetLeftChannel(audio).Normalize
right_ch = GetRightChannel(audio).Normalize
audio = MonoToStereo(left_ch, right_ch)
return AudioDub(video, audio)

# normalizes each channel seperately
clip = AviSource(&quot;D:\Video\rawstuff\stereo-test file_left(-6db).avi&quot;)
left_ch = GetChannel(clip,1).Normalize
right_ch = GetChannel(clip,2).Normalize
audio = MergeChannels(left_ch, right_ch)
AudioDub(clip, audio)</pre>
<p><kbd>$Date: 2005/10/03 16:49:04 $</kbd></p>
<form><input TYPE="Button" VALUE="Back"
onClick="history.go(-1)"></form>
</body>
</html>
